home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Present…nuary (Partner) - Disc 1
/
The Apple Reference and Presentations Library (Disc 1)(January 1994).iso
/
Frame Technology
/
US English
/
FrameMaker 4-68K
/
Samples
/
PostScript
/
BigRGB.ps
next >
Wrap
Text File
|
1994-03-22
|
4KB
|
155 lines
% BigRGB.ps
% Fills a FrameMaker text column with a string.
% Options: color filled, color outlined, or both
%
% This program does more than BigFill.ps and BigLine.ps combined.
%
% Modification Log:
% Dec 8, 1988 Added /E mode and /CE corner
% Dec 14, 1990 Added color
% Aug 20, 1991 Merged Fill and Line functions
% Jul 22, 1992 Changed to accept both gray and RGB values
% Sep 14, 1992 Edited comments to match SpecEffects
%
% Required Arguments:
% (string) /font /fillmode rotation /alignment fillcolor linecolor linewidth
%
% 1 = string in parenthesis ie. (MYSTRING)
% 2 = font desired: /font ie. /Times-Roman
% 3 = fill mode
% where /W = fill width, /H = fill height,
% /B = fill both, /E = fill either (whichever
% is smaller)
% 4 = rotation (from -180 to +180)
% where positive = counterclockwise,
% negative = clockwise
% 5 = alignment (with text column)
% where /LL = lower left, /LR = lower right,
% /UL = upper left, /UR = upper right,
% /CE = centered in text column
% 6 = fill color
% formats: [ Red Green Blue ] or gray
% [] means no fill, [0 0 0] or 0 means black
% from 0 to 1 where 0 = dimmist , 1 = brightest
% 7 = line color
% formats: [ Red Green Blue ] or gray
% [] means no outline, [1 1 1] or 1 means white
% 8 = line width (in points)
% if negative number, prints outline on top of fill
%
% Sample Usage:
% % To write the word in turqoise with 2 point black outline
% % at 45 degree centered in the text column.
% (Hello) /Times-Roman /E 45 /CE [ .25 .8785 .8157 ] 0 2
% #include "BigRGB.ps"
%
% If you are familiar with BigFill.ps and BigLine.ps from previous releases,
% here are the equivalent calls to get the same results:
%
% % 45 degree text filled with 50% gray
% (Hello) /Times-Roman /B 45 /LL 0.5
% #include "BigFill.ps"
%
% is equivalent to
%
% % 45 degree text filled with 50% gray and no outline
% (Hello) /Times-Roman /B 45 /LL 0.5 [] 0
% #include "BigRGB.ps"
%
% while
%
% % 45 degree text in black 2 point outline
% (Hello) /Times-Roman /B 45 /LL 2
% #include "BigLine.ps"
%
% is equivalent to
%
% % 45 degree text in black 2 point outline and no fill
% (Hello) /Times-Roman /B 45 /LL [] 0 2
% #include "BigRGB.ps"
%
% RGB values of several colors can be found in
% /usr/lib/X11/rgb.txt for X Windows
% /usr/openwin/lib/rgb.txt for Sun Open Windows
% Divide the values by 255 to normalize them between 0 and 1.
/thick exch def
dup type /arraytype ne {
/drawline true def
/lineblue 1 index def
/linegreen 1 index def
/linered exch def
}{
dup length 3 eq /drawline 1 index def {
aload pop
/lineblue exch def
/linegreen exch def
/linered exch def
}{ pop
} ifelse
} ifelse
dup type /arraytype ne {
/drawfill true def
/fillblue 1 index def
/fillgreen 1 index def
/fillred exch def
}{
dup length 3 eq /drawfill 1 index def {
aload pop
/fillblue exch def
/fillgreen exch def
/fillred exch def
}{ pop
} ifelse
} ifelse
/start exch def
/rotval exch def
/mode exch def
findfont /infont exch def
/printme exch def
/hframe exch def % left on stack by Maker
/wframe exch def % ditto
pop pop % clean up extra argument passed by Maker
0 0 moveto
/scaler 12 def % avoid PS rounding problems
infont scaler scalefont setfont
/wpath printme stringwidth pop def
/wfont wframe wpath div scaler mul def
/hpath (X) false charpath flattenpath pathbbox 4 1 roll pop pop pop def
/hfont hframe hpath div scaler mul def
mode /W eq {/hfont wfont def} if
mode /H eq {/wfont hfont def} if
mode /E eq {
hfont wfont ge {/hfont wfont def} {/wfont hfont def} ifelse
} if
infont [wfont 0 0 hfont 0 0] makefont setfont
newpath 0 0 moveto
start /LR eq {wframe 0 moveto} if
start /UL eq {0 hframe moveto} if
start /UR eq {wframe hframe moveto} if
start /CE eq
{wframe 2 div hframe 2 div translate
rotval rotate % rotate about the mid point
wframe -2 div hframe -2 div translate
wframe wpath wfont mul 12 div sub 2 div
hframe hpath hfont mul 12 div sub 2 div moveto}
{rotval rotate} ifelse
gsave
thick 0 ge drawline and {
thick setlinewidth
linered linegreen lineblue setrgbcolor
printme false charpath stroke
grestore
gsave
} if
drawfill {
fillred fillgreen fillblue setrgbcolor
printme show
grestore
} if
thick 0 lt drawline and {
thick neg setlinewidth
linered linegreen lineblue setrgbcolor
printme false charpath stroke
} if